<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<div class="full-width">

	<div class="alert alert-info font-22 margin-all">
	  <c:out value="${reviewer.firstName} ${reviewer.lastName }" escapeXml="false" default=""/>'s Profile
	</div>	
	<div class="row">
  		<div class="col-xs-5 col-sm-5 col-md-5 col-lg-5">
  			<div class="padding-all border-right">
  				<div class="padding-bottom customer-info font-16">
              			<div class="">
               				<i class="icon-user icon-large 
              				<c:choose>
							<c:when test="${not empty customer and reviewer.id eq customer.id}">
								font-orange
							</c:when>
							<c:otherwise>
	               				font-lightgrey
							</c:otherwise>
						</c:choose>
              				"></i>
              				<span class=""><c:out value="${reviewer.firstName}" escapeXml="false" default=""/></span>
              				<span class=""><c:out value="${reviewer.lastName}" escapeXml="false" default=""/></span>
              			</div>
              			<div class="margin-top-half">
              				<span class=""><c:out value="${reviewer.residentAddress.city}" escapeXml="false" default=""/></span>
              				<span class=""><c:out value="${reviewer.residentAddress.state}" escapeXml="false" default=""/></span>
              			</div>
              			<div class="margin-top-half">
              				<span class=""><c:out value="${fn:length(reviewer.reviews)}" escapeXml="false" default=""/></span>
              				<span class="">reviews</span>
              			</div>
              		</div>
              		<h5>Rating distribution</h5>
					<div class="margin-right-dbl margin-vertical rating-distribution font-18" >
						<jsp:include page="/WEB-INF/modules/star-rating-distribution-chart.jsp">
							<jsp:param value="${fn:length(reviewsFor5str)},${fn:length(reviewsFor4str)},${fn:length(reviewsFor3str)},${fn:length(reviewsFor2str)},${fn:length(reviewsFor1str)}" name="starDistribution"/>
						</jsp:include>
						<%--
							<jsp:param value="128,328,365,758,12" name="starDistribution"/>
						 --%>
					</div>	              		
  			</div>
  		</div>		
  		<div class="col-xs-7 col-sm-7 col-md-7 col-lg-7">
  			<div class="padding-all">
  				<div class="review-list">
				<c:forEach items="${reviewList}" var="review" varStatus="rvStatus">
					<div class="review pull-left full-width" id="review-${review.id}">
						<span class="review-id hide">${review.id}</span>
						<span class="office-id hide">${review.office.id}</span>
						<span class="review-rating hide">${review.rating}</span>
						<span class="review-title hide">${review.title}</span>
						<span class="review-content hide">${review.content}</span>
								<h5>
									<a href="<c:url value='/office.html?id=${review.office.id}' />">
										<c:out value="${review.office.business.businessName}/${review.office.address.city }" escapeXml="false" default=""/>
									</a>
								</h5>
										<div class="">
											<i class="icon-location-arrow font-dark"></i>
											<c:out value="${review.office.address.addressLine1 }"/>
										</div>
										<div class=""><c:out value="${review.office.address.addressLine2}"/></div>
										<div class="">
											<c:out value="${review.office.address.city}"/>,
											<c:out value="${review.office.address.state}"/>
											<c:out value="${review.office.address.zip}"/>
										</div>
								<div class="">
									<span class="bold">Specialty:</span>
									<c:out value="${review.office.specialty }" escapeXml="false"/>
								</div>	
			          			<div class="office-rating margin-top">
				                   		<c:set var="rating" value="${review.rating}"/>
				                   		<div class="margin-top-half rating font-orange font-18">
											<jsp:include page="/WEB-INF/modules/displayStarsByRating.jsp">
												<jsp:param value="${review.rating}" name="rating"/>
											</jsp:include>
											<span class="margin-left review-date font-16 font-dark">
												<c:choose>
													<c:when test="${not empty review.dateUpdated}">
														<fmt:formatDate pattern="M/d/yyyy" value="${review.dateUpdated }" />
													</c:when>
													<c:when test="${not empty review.dateCreated}">
														<fmt:formatDate pattern="M/d/yyyy" value="${review.dateCreated }" />
													</c:when>
													<c:otherwise>
													</c:otherwise>
												</c:choose>
											</span>
				                   </div>
			                    </div>
			                    <h4 class="review-content font-16 bold serif  capitalize">
			                    	<c:out value="${review.title}" escapeXml="false" default=""/>
			                    </h4>
			                    <div class="review-content font-14 serif margin-top">
			                    	<c:out value="${review.content}" escapeXml="false" default=""/>
			                    </div>
			                    <div class="clearfix"></div>
								<div class="clear-both"></div>
			                    <c:if test="${not empty customer and reviewer.id eq customer.id}">
				                    <div class="margin-top edit">
				                    	<a class="btn btn-sm btn-info edit-review" href="#review-${review.id}">
  											<i class="icon-edit"></i> Edit
										</a>
				                    </div>
								</c:if>			                    
					</div>
					<div class="clearfix"></div>
					<c:if test="${not rvStatus.last}">
						<div class="separate-row-single-1px"></div>
					</c:if>
				</c:forEach>
				
			</div>
  			</div>
  		<ul class="pagination">
		  <li><a href="#">&laquo;</a></li>
		  <li><a href="#">1</a></li>
		  <li><a href="#">2</a></li>
		  <li><a href="#">3</a></li>
		  <li><a href="#">4</a></li>
		  <li><a href="#">5</a></li>
		  <li><a href="#">&raquo;</a></li>
		</ul>		
  		</div>
	</div>
</div>
<jsp:include page="/WEB-INF/modules/ksr-overlays.jsp">
	<jsp:param value="reviewer" name="redirect"/>
</jsp:include>
<div class="clearfix"></div>
<script type="text/javascript">
<!--
	KSR.Office.init();
//-->
</script>